home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1988 June
/
64er_Magazin_88-06_1988_Markt__Technik_de_Side_A.d64
/
f-plot 1520 v2.0
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
166 lines
10 rem ************************
15 rem *** f-plot 1520 v2.0 ***
20 rem *** hamburg 1986 ***
30 rem *** by ingo jaenicke ***
40 rem ************************
41 rem
42 rem angeregt zu diesem programm
43 rem wurde ich durch ein aehnliches,
44 rem aber in vieler hinsicht unzu-
45 rem reichendes programm von heimo
46 rem ponnath, das im 64'er 11/85
47 rem s.153 veroeffentlicht wurde.
48 rem
50 poke53280,0:poke53281,0:poke646,14:poke2,3
54 :
55 rem ****** funktionseingabe ******
56 :
60 gosub1000
80 print" geben sie ein: "
85 input"f(x)=";f$
90 print"[147][144]110f$="chr$(34)f$chr$(34)
91 print"115deffnf(x)="f$
92 print"111xl="xl":xr="xr:print"112yl="yl":yr="yr":bs="bs
95 print"113ix="ix":iy="iy":yg="yg
96 print518-peek(2)"f$("peek(2)")="chr$(34)f$chr$(34)
97 print"goto110"
100 printchr$(19):poke631,13:poke632,13:poke633,13
105 poke634,13:poke635,13:poke636,13:poke637,13:poke198,7:end
110 f$=".5*x"
111 xl=-5 :xr= 5
112 yl=-3 :yr= 3 :bs= 160
113 ix= 10 :iy= 6 :yg= 144
115 deffnf(x)=.5*x
116 open4,6:open1,6,1:open2,6,2:open3,6,3:open5,6,5
117 :
118 rem *** intervall-eingabe ***
119 :
123 ifpeek(2)<3then400
125 c$=" ":gosub1000
130 print"x-intervall von";:inputxl
135 print"[145]:bis";:inputxr:print"[145]"tab(26)":"
140 ix=abs(xr-xl):ifxl>=xrthenprint"[145]"c$"[145][145][145]":goto130
145 print"(y-intervall darf nicht"
150 print"groesser als"ix*2"sein !)[145][145][145][145][145][154]"
155 print"y-intervall von";:inputyl
160 print"[145]:bis";:inputyr:print"[145]"tab(26)":"
165 ifyl>=yrthenprint"[145]"c$"[145][145]":goto155
170 iy=abs(yr-yl):ifiy>ix*2thenprint"[145]"c$"[145][145]":goto155
175 print""c$:printc$
180 print"[145]anzahl der berechnungsschritte 160[157][157][157][157][157]";:inputbs
185 ifbs>479thenprint"[145]"c$:goto180
190 print"[145]"tab(32)":"
207 :
208 rem *** vorbereitende schritte ***
209 :
210 yg=iy*240/ix
215 print#2,0:print#1,"m",0,-yg:print#1,"i"
220 print#1,"j",0,-yg:print#1,"j",479,-yg
225 print#1,"j",479,yg:print#1,"j",0,yg
230 print#1,"j",0,0
232 :
233 rem *** ko-system potten ***
234 :
235 print#5,3:ifsgn(yl)=sgn(yr)then247
240 xa=abs(yl)*2*yg/iy:print#1,"r",0,xa-yg:print#1,"j",479,xa-yg:fx=1
247 ifsgn(xl)=sgn(xr)then255
250 ya=abs(xl)*480/ix:print#1,"r",ya,yg:print#1,"j",ya,-yg:fy=1
255 print#5,0:print#1,"r",0,0
256 :
257 rem *** achsenabscnitte plotten ***
258 :
260 ifix>25then950
265 iffx=0then300
270 fx=0:ifxl<0thenxb=(int(xl)+1-xl)*480/ix:goto280
275 xb=(xl-int(xl))*480/ix
280 xc=480/ix
285 fori=0toix-1:print#1,"r",xb+xc*i,xa-yg+3
290 print#1,"j",xb+xc*i,xa-yg-3
295 nexti
300 iffy=othen335
305 fy=0:ifyl<0thenyb=(int(yl)+1-yl)*2*yg/iy:goto315
310 yb=(yl-int(yl))*2*yg/iy
315 yc=2*yg/iy
320 fori=0toiy-1:print#1,"r",ya-3,-yg+yb+yc*i
325 print#1,"j",ya+3,-yg+yb+yc*i
330 nexti
332 :
333 rem *** einheitszahlen plotten ***
334 :
335 print#3,0:print#1,"r",0,xa-yg:print#1,"i"
340 ifxr<(ix/30)oryl>(-7*iy/yg)then347
341 ifxl>0oryr<0then347
345 print#1,"r",ya+5,-12:print#4,"0":print#1,"m",0,22:print#1,"i"
347 ifxr<(1+(ix/120))oryl>(-8*iy/yg)then353
348 ifxl>(1-(ix/120))oryr<0then353
350 print#1,"r",ya+yc-2,-14:print#4,"1":print#1,"m",0,24:print#1,"i"
353 ifxr<(ix*7/240)oryl>(-1-(4*iy/yg))then360
354 ifxl>0oryr<(-1+(4*iy/yg))then360
355 print#1,"r",ya+6,-yc-5:print#4,"-1":print#1,"m",0,yc+15:print#1,"i"
360 print#1,"r",0,yg-xa:print#1,"i"
397 :
398 rem *** plotten der funktion ***
399 :
400 gosub1000:print#2,peek(2):fw(0)=fnf(xl)
405 iffw(0)<ylthenprint#1,"r",0,-yg:goto420
410 iffw(0)>yrthenprint#1,"r",0,yg:goto420
415 print#1,"r",0,-yg+(abs(fw(0)-yl)*2*yg/iy)
420 forx=(xl+ix/bs)toxrstepix/bs
425 fw(1)=fnf(x)
430 iffw(0)>yrandfw(1)>yrthenbm$="r":fp=yg:goto465
435 iffw(0)>yrandfw(1)<ylthenbm$="j":fp=-yg:goto465
440 iffw(0)<ylandfw(1)>yrthenbm$="j":fp=yg:goto465
445 iffw(0)<ylandfw(1)<ylthenbm$="r":fp=-yg:goto465
450 iffw(1)>yrthenbm$="j":fp=yg:goto465
455 iffw(1)<ylthenbm$="j":fp=-yg:goto465printyg
460 bm$="j":fp=-yg+(abs(fw(1)-yl)*2*yg/iy)
465 print#1,bm$,abs(x-xl)*480/ix,fp
470 fw(0)=fw(1):nextx
475 print#1,"r",0,0
477 :
478 rem *** weitere funktionen ? ***
479 :
480 ifpeek(2)=0thengoto515
485 gosub1000:print" soll noch eine weitere funktion"
490 print" in dieses koordinatensystem"
495 print" geplottet werden (j/n) ?"
500 getb$:ifb$="n"then515
505 ifb$<>"j"then500
510 poke2,peek(2)-1:goto60
512 :
513 rem *** abschliessende schritte ***
514 :
515 f$( 3 )="x^2"
516 f$( 2 )=".5*x"
517 f$(1)=""
518 f$(0)=""
519 :
520 f$="":gosub1000:print#1,"r",0,-yg-10:print#4
525 print#2,0:print#3,1
530 print#4,"i : ["xl","xr"]"
535 print#4,"i : ["yl","yr"]"
540 print#3,0:print#1,"m",13,39
545 print#4,"x":print#4:print#1,"m",13,0:print#4,"y":print#3,1:print#4
550 fori=3topeek(2)step-1
555 print#2,i
560 iflen(f$(i))<35then575
565 print#4,"[198]([216])="left$(f$(i),35)
570 print#4," "mid$(f$(i),36,len(f$(i))-35):goto580
575 print#4,"[198]([216])="f$(i)
580 nexti
585 print#2,0:print#3,0:print#1,"m",396,5
590 print#4,"([195])'86 [194][217] i.j.":print#3,1:print#4:print#4:print#4:print#4
595 close1:close2:close3:close4:close5
600 print"n[146]eues koordinatensystem":print"oder"
605 print"p[146]rogrammende ?"
610 getb$:ifb$="p"thensys64738
615 ifb$<>"n"then610
620 goto60
997 :
998 rem *** up-kopfzeile ***
999 :
1000 print"[147][150] funktionen-plot auf dem vc-1520[154]"
1001 a$="[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
1010 printa$:print"[145]f(x)="f$:printa$
1020 return